/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aybolit.core.objects;

import aybolit.core.objects.dao.DepartmentDao;
import aybolit.core.objects.dao.HospitalsDao;
import aybolit.core.objects.model.Beds;
import aybolit.core.objects.model.Hospitales;
import aybolit.core.objects.model.Operators;
import aybolit.core.objects.model.Departments;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.List;
import javax.faces.context.FacesContext;

/**
 *
 * @author Vadim
 */
public class forTopBean implements Serializable{
    HospitalsDao hospitalsDao;
    DepartmentDao departmentDao;
    public String getDate() {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd.MM.yyyy HH:mm");
        Calendar calen = Calendar.getInstance();
        Timestamp timestamp = new Timestamp(calen.getTime().getTime());
        return sdf.format(timestamp);
    }

    public Operators getOperator() {
        FacesContext context = FacesContext.getCurrentInstance();
        Operators oper = (Operators) context.getExternalContext().getSessionMap().get("oper");
        return oper;
    }

    public Hospitales getHospitale() {
        List<Hospitales> hostList = hospitalsDao.findAllHospitales();
        Hospitales hospitales = hostList.get(0);
        return hospitales;
    }
    public Departments getDepartmentname() {
        List<Departments> depList = departmentDao.findAllDepartment();
        Departments departments = depList.get(0);
        return departments;
    }

    public void setHospitalsDao(HospitalsDao hospitalsDao) {
        this.hospitalsDao = hospitalsDao;
    }

    public void setDepartmentDao(DepartmentDao departmentDao) {
        this.departmentDao = departmentDao;
    }

    

    
}
